#ifndef STATISTICALWIDGET_H
#define STATISTICALWIDGET_H

#include "qsqlquerymodel.h"
#include <QBarSet>
#include <QChart>
#include <QPieSeries>
#include <QStackedBarSeries>
#include <QWidget>

#include <QWidget>
#include <QDebug>
#include <QTimer>
#include <QTime>
#include <QValueAxis>

#include <QChart>
#include <QSplineSeries>
#include <QScatterSeries>
#include <QPieSeries>
#include <QLineSeries>
#include <QBarSeries>
#include <QBarset>
#include <QStackedBarSeries>
#include <QBarCategoryAxis>

#include <QProgressBar>
#include <QLabel>
#include <QPushButton>
#include <QSqlQuery>

#include <QList>

#include <QVariantAnimation>

#include <QtCharts>
QT_CHARTS_USE_NAMESPACE

namespace Ui {
class StatisticalWidget;
}

class StatisticalWidget : public QWidget
{
    Q_OBJECT

public:
    explicit StatisticalWidget(QWidget *parent = nullptr);
    ~StatisticalWidget();

signals:
    void queryStatistical(const QString &timeRange, const QString &dept, const QString &status, const QDate &date);
public slots:
    void do_updateStatiscalView(QSqlQuery query);

    void do_updateDeptCoboxCom(QStringList &deptNames);

    void do_updateStatiscalChart(QSqlQuery query);

    void on_btn_update_clicked();

private:
    Ui::StatisticalWidget *ui;

    QTimer* time_run;

    /*饼状图-start*/
public:
    QChart* Chart_pie;
    QPieSeries* series_pie;
    void pie_init(void);
public slots:
    void slot_pie_roll(void);
    void do_pie_roll(const QString &Title,  const QMap<QString, double> &deptMap);
    /*饼状图-end*/

    /*柱状图-start*/
public:
    QStackedBarSeries * series_bar;
    QChart* Chart_bar;
    QBarSet *barH;
    QBarSet *barL;
    void bar_init(void);
public slots:
    void slot_bar_roll(void);
    void do_bar_roll(const QString &Title,  const QMap<QString, double> &deptMap);
    /*柱状图-end*/


    /*内容换肤*/

public:
    struct colorSkin
    {
        QColor color_1;
        QColor color_2;
        QColor color_3;
        QString progress_color1;
        QString progress_color2;
    };
    colorSkin mySkin[4];
    int curr_skin;//当前皮肤

private slots:
    void on_btn_export_clicked();

private:

    QSqlQueryModel *m_statisticalModel;
};

#endif // STATISTICALWIDGET_H
